/**
 * Created by guomin on 2017/5/4.
 */
var Promise=require('bluebird');
var pool=require('../conf/pool');

//使用连接池，提升性能
var _pool=pool.init();
function getSqlConnection(){
    return _pool.getConnection().disposer(function(connection){
        _pool.releaseConnection(connection);
    })
}
exports=module.exports=function(){
    return new Promise(function(resolve,reject){
        Promise.using(getSqlConnection(),function(connection) {
            resolve(connection);
        }).catch(function(err){
            reject(err);
        });
    });
};